import { get, post, put, del } from './request'

/**
 * 房屋API模块
 */

// 获取房屋列表
const getHouseList = (params) => {
  return get('/house/list', params)
}

// 获取房屋详情
const getHouseDetail = (id) => {
  return get(`/house/${id}`)
}

// 添加房屋
const addHouse = (data) => {
  return post('/house', data)
}

// 更新房屋信息
const updateHouse = (id, data) => {
  return put(`/house/${id}`, data)
}

// 删除房屋
const deleteHouse = (id) => {
  return del(`/house/${id}`)
}

// 搜索房屋
const searchHouses = (keyword) => {
  return get('/house/search', { keyword })
}

// 测试API函数 - 获取拼车信息
const getCarpoolPreview = () => {
  return get('/carpoolInfo/preview')
}

export {
  getHouseList,
  getHouseDetail,
  addHouse,
  updateHouse,
  deleteHouse,
  searchHouses,
  getCarpoolPreview
} 